package com.chance.cc.crawler.development.command.trigger.domain.weibo;

import com.chance.cc.crawler.core.CrawlerJob;
import com.chance.cc.crawler.development.command.job.domain.weibo.api.geely.WeiboGeelyKeywordsRealtimeCrawlerSchedulerJob;
import com.chance.cc.crawler.development.command.job.domain.weibo.api.realtime.WeiboKeywordsRealtimeCrawlerSchedulerJob;
import com.chance.cc.crawler.development.command.job.domain.weibo.api.realtime.WeiboUIDRealtimeCrawlerSchedulerJob;
import com.chance.cc.crawler.development.command.job.domain.weibo.api.trace.WeiboKeywordsTraceCrawlerSchedulerJob;
import com.chance.cc.crawler.development.command.job.domain.weibo.api.trace.WeiboUIDTraceCrawlerSchedulerJob;
import com.chance.cc.crawler.development.command.trigger.CommonCrawlerTestSchedulerTrigger;
import com.chance.cc.crawler.meta.core.bean.CrawlerMetaConstant;

/**
 * @author lt
 * @version 1.0
 * @date 2021-03-17 11:28:07
 * @email okprog@sina.com
 */
public class WeiboAPICrawlerTrigger extends CommonCrawlerTestSchedulerTrigger {

    public static void main(String[] args) {
//        publishWeiboSearchKWRealtimeCrawlerScheduleTriggerInfo();
//
//        publishWeiboSearchKWTraceCrawlerScheduleTriggerInfo();
//
//        publishWeiboUIDRealtimeCrawlerScheduleTriggerInfo();
//
//        publishWeiboUIDKWTraceCrawlerScheduleTriggerInfo();

        publishWeiboGeelyKeywordCrawlerScheduleTriggerInfo();
    }

    /**
     * 发布微博API关键词采集实时任务trigger info

     */
    public static void publishWeiboSearchKWRealtimeCrawlerScheduleTriggerInfo(){
        CrawlerJob crawlerJob = WeiboKeywordsRealtimeCrawlerSchedulerJob.crawlerJobScheduler();

        metaServiceCommand_15.addOrUpdateScheduleCrawlerTrigger(
                crawlerJob.generateCrawlerKey(),
                crawlerJob.generateCrawlerTriggerKey(),
                WeiboKeywordsRealtimeCrawlerSchedulerJob.domain,
                CrawlerMetaConstant.ScheduleJobTrigger_Cron,
                "0 0 0/2 * * ?",
                "微博API关键词实时采集任务执行，每两小时执行一次"
        );
    }
    /**
     * 发布微博API关键词采集回溯任务trigger info

     */
    public static void publishWeiboSearchKWTraceCrawlerScheduleTriggerInfo(){
        CrawlerJob crawlerJob = WeiboKeywordsTraceCrawlerSchedulerJob.crawlerJobScheduler();

        metaServiceCommand_15.addOrUpdateScheduleCrawlerTrigger(
                crawlerJob.generateCrawlerKey(),
                crawlerJob.generateCrawlerTriggerKey(),
                WeiboKeywordsRealtimeCrawlerSchedulerJob.domain,
                CrawlerMetaConstant.ScheduleJobTrigger_Cron,
                "0 0 0 * * ?",
                "微博API关键词24小时回溯采集任务执行，每天执行一次"
        );
    }

    /**
     * 发布微博API-UID关键词采集实时任务trigger info

     */
    public static void publishWeiboUIDRealtimeCrawlerScheduleTriggerInfo(){
        CrawlerJob crawlerJob = WeiboUIDRealtimeCrawlerSchedulerJob.crawlerJobScheduler();

        metaServiceCommand_15.addOrUpdateScheduleCrawlerTrigger(
                crawlerJob.generateCrawlerKey(),
                crawlerJob.generateCrawlerTriggerKey(),
                WeiboKeywordsRealtimeCrawlerSchedulerJob.domain,
                CrawlerMetaConstant.ScheduleJobTrigger_Cron,
                "0 0 0/2 * * ?",
                "微博API-UID关键词实时采集任务执行，每两小时执行一次"
        );
    }
    /**
     * 发布微博API-UID关键词采集回溯任务trigger info

     */
    public static void publishWeiboUIDKWTraceCrawlerScheduleTriggerInfo(){
        CrawlerJob crawlerJob = WeiboUIDTraceCrawlerSchedulerJob.crawlerJobScheduler();

        metaServiceCommand_15.addOrUpdateScheduleCrawlerTrigger(
                crawlerJob.generateCrawlerKey(),
                crawlerJob.generateCrawlerTriggerKey(),
                WeiboKeywordsRealtimeCrawlerSchedulerJob.domain,
                CrawlerMetaConstant.ScheduleJobTrigger_Cron,
                "0 0 0 * * ?",
                "微博API-UID关键词24小时回溯采集任务执行，每天执行一次"
        );
    }


    /**
     * 微博吉利项目关键词采集
     */
    public static void publishWeiboGeelyKeywordCrawlerScheduleTriggerInfo(){
        CrawlerJob crawlerJob = WeiboGeelyKeywordsRealtimeCrawlerSchedulerJob.crawlerJobScheduler();

        metaServiceCommand_15.addOrUpdateScheduleCrawlerTrigger(
                crawlerJob.generateCrawlerKey(),
                crawlerJob.generateCrawlerTriggerKey(),
                WeiboKeywordsRealtimeCrawlerSchedulerJob.domain,
                CrawlerMetaConstant.ScheduleJobTrigger_Cron,
                "0 0 17 * * ?",
                "微博吉利项目每日凌晨三点定时采集"
        );
    }
}
